from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By

browser = webdriver.Chrome()

url = "https://www.baidu.com"
browser.get(url)

sleep(2)
input = browser.find_element(By.NAME, 'wd')
input.send_keys("周杰伦")

sleep(2)
button = browser.find_element(By.ID, 'su')
button.click()

sleep(2)
# 滑倒底部
js_bottom = 'document.documentElement.scrollTop=100000'
browser.execute_script(js_bottom)

sleep(2)
bottom_button = browser.find_element(By.CLASS_NAME, 'n')
bottom_button.click()
sleep(2)

# 回到上一页
browser.back()

sleep(2)

browser.forward()

sleep(3)

browser.quit()